<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="referrer" content="no-referrer">
    <title>Document</title>
    <link rel="stylesheet" href="./element-ui/element-ui.css">
    <link rel="stylesheet" href="./css/base.css">
    <link rel="stylesheet" href="./css/messageBox.css">
    <script src="./js/common.js"></script>
    <script src="./js/jquery-1.8.0.min.js"></script>
    <script src="./js/vue.js"></script>
    <script src="./element-ui/element-ui.js"></script>
    <script src="./js/messageBox.js"></script>
    <script src="./js/http-vue-loader.js"></script>
</head>

<body>
    <div id="app" class="app">
        <nav-bar></nav-bar>
        <!-- start 页面切换的位置 -->
        <home-page class="content-box" v-if="pageName=='homePage'" ></home-page>
        <films-page class="content-box" v-if="pageName=='filmsPage'" @change-page="changePage"></films-page>
        <detail-page class="content-box" v-if="pageName=='detailPage'" :film-id="filmId"></detail-page>
        <!-- end 页面切换的位置 -->
        <footer-bar v-if="pageName=='detailPage'"></footer-bar>
    </div>
</body>
<script>
    new Vue({
        el: "#app",
        components: {
            NavBar: httpVueLoader("./components/NavBar.vue"),
            FooterBar: httpVueLoader("./components/FooterBar.vue"),
            HomePage: httpVueLoader("./views/HomePage.vue"),
            FilmsPage: httpVueLoader("./views/FilmsPage.vue"),
            DetailPage: httpVueLoader("./views/DetailPage.vue")
        },
        data: {
            pageName: "filmsPage",
            filmId:""
        },
        methods: {
            changePage(obj) {
                console.log(obj);
                this.pageName = obj.name;
                this.filmId = obj.filmId;
            }
        },
    })
</script>

</html>